﻿using System;

namespace ECommerce.Controls
{
	public partial class NewsContent : BaseUserControl
	{
		private Service.INewsService _NewsService;

		public int NewsID
		{
			get
			{
				return CommonHelper.QueryStringInt("newsid");
			}
		}

		protected void Page_PreRender(object sender, EventArgs e)
		{
			BindData();
		}

		private void BindData()
		{
			if (_NewsService == null)
			{
				_NewsService = new Service.NewsService();
			}
			var news = _NewsService.GetTheNews(NewsID);

			this.Page.Title = news.Title + "-" + GetLocalResourceString("Ecommerce.SiteName");

			this.lTitle.Text = news.Title;
			this.lCreatedOn.Text = news.CreatedOn.ToString();
			this.lFull.Text = news.FullContent;
		}
	}
}